package com.boc.ewr.uniapp.api.controller;

import com.boc.ewr.uniapp.api.service.ICaDetailService;
import com.boc.ewr.uniapp.api.vo.CaUncaDtlRespVo;
import com.boc.ewr.uniapp.api.vo.CaUncaDtlVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : Wzz
 * @create : 2023-05- 23- 16:58
 * @desc :
 */
@Api(tags = "对账任务明细")
@RestController
@RequestMapping("/uniapp/ca/detail")
@Slf4j
public class CaDetailApiController {

    @Autowired
    private ICaDetailService caDetailService;

    /**
     * 分页选择查询
     *
     * @param acctType
     * @return
     */
    //@AutoLog(value = "未对账账户明细-分页列表查询")
    @ApiOperation(value = "未对账账户明细-分页列表查询", notes = "未对账账户明细-分页列表查询")
    @GetMapping(value = "/listByAcctType")
    public Result<List<CaUncaDtlVo>> queryPageList(
            @RequestParam(name = "acctType", defaultValue = "A1") String acctType,
             @RequestParam(name = "likeName", defaultValue = "") String likeName) {

        List<CaUncaDtlVo> pageList = caDetailService.getCaDetailByType(acctType,likeName);
        return Result.OK(pageList);
    }

    /**
     * 通过行信app反馈工作记录
     *
     * @param caUncaDtlRespVo
     * @return
     */
    @AutoLog(value = "未对账账户明细-通过行信app反馈工作记录")
    @ApiOperation(value = "未对账账户明细-通过行信app反馈工作记录", notes = "未对账账户明细-通过行信app反馈工作记录")
    @RequestMapping(value = "/addWorkRecord", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<String> addWorkRecord(@RequestBody CaUncaDtlRespVo caUncaDtlRespVo) {
        caDetailService.addWorkRecord(caUncaDtlRespVo);

        return Result.OK("反馈成功!");
    }

}
